package com.foreveredu.propms.domain;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Description:<br/>
 * 领域模型：收费项目类，一个小区包含多个物业收费项目，一个收费项目可依据不同收费标准进行收费<br/>
 * Date:<br/>
 * 2013/3/2<br/>
 * 
 * @author hushigang
 */

@Entity
@Table(name = "T_ChargeItem")
public class ChargeItem implements Serializable {

	private static final long serialVersionUID = 1L;
	private int id;
	private String itemId;// 收费项目编号
	private String name;// 收费项目名称
	private ChargeUnit chargeUnit;// 收费单位，平方米/吨/度
	private ChargeWay chargeWay;// 收费方式，按月收费/半年/年/一次性收费
	private String remark;// 备注信息
	private Set<House> houses;//该收费项目对应的房产集合
	private int type;//是否为单独收费项目，0为统一收费项目，1为单独收费项目

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column
	public String getItemId() {
		return itemId;
	}

	public void setItemId(String itemId) {
		this.itemId = itemId;
	}

	@Column
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@ManyToOne
	@JoinColumn(name = "chargeWay_id")
	public ChargeWay getChargeWay() {
		return chargeWay;
	}

	public void setChargeWay(ChargeWay chargeWay) {
		this.chargeWay = chargeWay;
	}

	@ManyToOne
	@JoinColumn(name = "chargeUnit_id")
	public ChargeUnit getChargeUnit() {
		return chargeUnit;
	}

	public void setChargeUnit(ChargeUnit chargeUnit) {
		this.chargeUnit = chargeUnit;
	}

	@ManyToMany(targetEntity = House.class, cascade = { CascadeType.PERSIST,
		CascadeType.MERGE, CascadeType.REMOVE }, mappedBy = "chargeItems")
	public Set<House> getHouses() {
		return houses;
	}

	public void setHouses(Set<House> houses) {
		this.houses = houses;
	}

	@Column
	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}
	
}
